home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODF-Interest Archive / July 96 / FW Another way of creating a p < prev    next >
Encoding:
Internet Message Format  |  1996-07-16  |  2.3 KB  |  [TEXT/ttxt]

  1. Subject:     FW: Another way of creating a part
  2. Sent:        7/15/96 3:27 PM
  3. Received:    7/15/96 4:01 PM
  4. From:        Chris Hunt, chris_hunt@yes.optus.com.au
  5. Reply-To:    ODF Interest, ODF-Interest@CILabs.ORG
  6. To:          OpenDoc Development Framework Discussion List, ODF-Interest@CILabs.
  7.  
  8. Previously posted to the OpenDoc list:
  9.  
  10. Hi there,
  11.  
  12. I've been experimenting with an idea for designing part editors...
  13.  
  14. All of the sample code I've seen implements a style of bridge pattern where the SOM part communicates with a C++ in a bi-directional fashion.  Whilst this doesn't present any big overhead, I feel that the SOM part could be used directly and that having a C++ object hanging around might therefore be unnecessary.  I note that the reasons for implementing a bridge are:
  15.  
  16. - little maintenance to the IDL thus promoting efficient compilations; and
  17. - developer's don't have to become familiar with IDL.
  18.  
  19. (I think that the second point is a non-starter given that learning SOM/CORBA IDL is a useful skill to have anyway.)
  20.  
  21. Now, making a change to the interface e.g. introducing a new method requires changing the IDL right?  Nope.  This, I suspect, has been the driving force behind creating the C++ bridge.  However, by use of the "passthru" directive in the "implementation" section of an IDL file, a developer can declare code that will be included directly in the emitted files of their choice.  I declared the following line in my IDL:
  22.  
  23.         passthru C_xih_after = "#include \"MyPart.h\"";
  24.  
  25. the above statement informs my IDL compiler to include the "#include \"MyPart.h\"" immediately after all other includes in my .xih file (SOM C++ implementation header file).  The \" is simply escaping the quotes so that the line is reproduced properly in the emitted file.
  26.  
  27. MyPart.h defines a specialisation of my SOM part (which, of course, is a specialisation of ODPart) but declares private and protected characteristics only.  Changes to MyPart.h do not require any IDL re-generation and I have only the one C++ object.
  28.  
  29. That's basically the crux of it.  Thoughts/ideas/suggestions please.
  30.  
  31. (It'd be neat to get a sample part code from Apple along these lines presuming that the idea's a good one).
  32.  
  33. Christopher Hunt    ?%^)
  34.  
  35. Class Action Pty. Ltd
  36. Wollongong, NSW
  37. AUSTRALIA
  38.  
  39. e-mail: chris_hunt@yes.optus.com.au
  40.